﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Spider
{
    /// <summary>
    /// 接口--抓取数据
    /// </summary>
    public interface ICatchData
    {
        #region 得到字段

        #region 无参数
        /// <summary>
        /// 得到字段(无参数)
        /// </summary>
        /// <returns>string</returns>
        string GetColumn();
        #endregion

        #region 只含网址
        /// <summary>
        /// 得到字段(含一个网址)
        /// </summary>
        /// <param name="url"></param>
        /// <returns>string</returns>
        string GetColumn(string url);
        /// <summary>
        /// 得到字段(含两个个网址)
        /// </summary>
        /// <param name="url1"></param>
        /// <param name="url2"></param>
        /// <returns>string</returns>
        string GetColumn(string url1, string url2);
        /// <summary>
        /// 得到字段(含多个网址)
        /// </summary>
        /// <param name="url"></param>
        /// <returns>string</returns>
        string GetColumn(string[] url);
        #endregion

        #region 只含条件参数
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="param"></param>
        /// <returns>string</returns>
        string GetColumn(object param);
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="param1"></param>
        /// <param name="param2"></param>
        /// <returns>string</returns>
        string GetColumn(object param1, object param2);
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="param"></param>
        /// <returns>string</returns>
        string GetColumn(object[] param);
        #endregion

        #region 一网址对应多个条件参数
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="param"></param>
        /// <param name="url"></param>
        /// <returns>string</returns>
        string GetColumn(object param, string url);
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="param1"></param>
        /// <param name="param2"></param>
        /// <param name="url"></param>
        /// <returns>string</returns>
        string GetColumn(object param1, object param2, string url);
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="param"></param>
        /// <param name="url"></param>
        /// <returns>string</returns>
        string GetColumn(object[] param, string url);
        #endregion

        #region 一条件参数对应多个网址
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="url"></param>
        /// <param name="param"></param>
        /// <returns>string</returns>
        string GetColumn(string url, object param);
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="url1"></param>
        /// <param name="url2"></param>
        /// <param name="param"></param>
        /// <returns>string</returns>
        string GetColumn(string url1, string url2, object param);
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="url"></param>
        /// <param name="param"></param>
        /// <returns>string</returns>
        string GetColumn(string[] url, object param);
        #endregion

        #region 多参数对应多网址
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="param1"></param>
        /// <param name="param2"></param>
        /// <param name="url1"></param>
        /// <param name="url2"></param>
        /// <returns>string</returns>
        string GetColumn(object param1, object param2, string url1, string url2);
        /// <summary>
        /// 得到字段
        /// </summary>
        /// <param name="param"></param>
        /// <param name="url"></param>
        /// <returns>string</returns>
        string GetColumn(object[] param, string[] url);
        #endregion

        #endregion

        #region 运行

        /// <summary>
        /// 执行逻辑(含有死循环)
        /// </summary>
        void Run();

        #endregion

        #region 抓取数据主方法

        /// <summary>
        /// 抓取数据(没有参数)--主要是for循环
        /// </summary>
        void CatchData();
        /// <summary>
        /// 抓取数据(按照日期date抓取)--主要是for循环
        /// </summary>
        /// <param name="date"></param>
        void CatchData(string date);
        /// <summary>
        /// 抓取数据(按照日期date和网址url抓取)--主要是for循环
        /// </summary>
        /// <param name="date"></param>
        /// <param name="url"></param>
        void CatchData(string date, string url);
        /// <summary>
        /// 抓取数据(按照日期date和网址url抓取并存放文件到本地target)--主要是for循环
        /// </summary>
        /// <param name="date"></param>
        /// <param name="url"></param>
        /// <param name="target"></param>
        void CatchData(string date, string url, string target);
        /// <summary>
        /// 抓取数据(按照日期date和网址url抓取并从指定地址source下载文件到本地target)--主要是for循环
        /// </summary>
        /// <param name="date"></param>
        /// <param name="url"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        void CatchData(string date, string url, string source, string target);
        /// <summary>
        /// 抓取数据(自定义参数)--主要是for循环
        /// </summary>
        /// <param name="param"></param>
        void CatchData(object[] param);

        #endregion

        #region 记录日志

        /// <summary>
        /// 记录日志(无参数)--(记录错误信息或者其他修改信息，可以用来被监视)
        /// </summary>
        void RecordLog();
        /// <summary>
        /// 记录日志(含有文件名)--(记录错误信息或者其他修改信息，可以用来被监视)
        /// </summary>
        /// <param name="filename"></param>
        void RecordLog(string filename);
        /// <summary>
        /// 记录日志(含有文件名和文件存放路径)--(记录错误信息或者其他修改信息，可以用来被监视)
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="filepath"></param>
        void RecordLog(string filename, string filepath);
        /// <summary>
        /// 记录日志(自定义条件)--(记录错误信息或者其他修改信息，可以用来被监视)
        /// </summary>
        /// <param name="param"></param>
        void RecordLog(object[] param);

        #endregion
    }
}
